#ifndef SCHEDULEMANAGER_H
#define SCHEDULEMANAGER_H

#include <QtGui>

#include "Database.h"

#include "ScheduleItem.h"

class ScheduleManager : public QSplitter
{
	Q_OBJECT

public:
	static void initialize( QWidget* parent );
	static ScheduleManager* instance();

private:
	//! Constructor
	ScheduleManager( QWidget* parent );
	//! Destructor
	virtual ~ScheduleManager();
	//! No Copy Constructor.
	ScheduleManager( ScheduleManager const& );
	//! No Assignment Operator.
	void operator = ( ScheduleManager const& ); 

public:
	QList<ScheduleItem*> getProgramSchedule( int id );
	QList<ScheduleItem*> getCourseSchedule( int id );
	QList<ScheduleItem*> getFacultySchedule( int id );
	QList<ScheduleItem*> getRoomSchedule( int id );

	void addItem( ScheduleItem* item );

	inline bool contains( int id ){ return mItems.contains( id ); }

private slots:
	void selected( const QModelIndex& index );

private:
	QMap<int,ScheduleItem*> mItems;
	QTableView* mTableView;

	QDataWidgetMapper* mMapper;

	QLineEdit* mNameInput;
	QLineEdit* mProgramInput;
	QLineEdit* mFacultyInput;
	QLineEdit* mRoomInput;
	QLineEdit* mCourseInput;
	QComboBox* mProgramSelector;
	QComboBox* mFacultySelector;
	QComboBox* mRoomSelector;
	QComboBox* mCourseSelector;
};

#endif SCHEDULEMANAGER_H